package reseau;

public class Coordonnees2D 
{
	protected double x;
	protected double y;
	
	public Coordonnees2D(double x, double y)
	{
		this.x = x;
		this.y = y;
	}

	public Coordonnees2D(Coordonnees2D copie)
	{
		this.copy(copie);
	}
	
	public void copy(Coordonnees2D copie)
	{
		this.x = copie.x;
		this.y = copie.y;
	}
	
	public double getX() 
	{ return x; }
	
	public double getY() 
	{ return y; }
	
	public void add(Coordonnees2D c)
	{
		this.x += c.x;
		this.y += c.y;
	}
	
	public double distanceA(Coordonnees2D c)
	{
		double distanceX = this.x - c.x;
		double distanceY = this.y - c.y;
		return Math.sqrt((distanceX*distanceX)+(distanceY*distanceY));
	}
	
	public boolean equals(Coordonnees2D c)
	{
		return 
		(
				this.x == c.x
				&&
				this.y == c.y
		);
	}
}
